/*
使用mockjs提供mock数据接口
 */
import Mock from 'mockjs';
import data from './data.json';
import commonJs from '../assets/js/commonJs'
import ajax from "../api/ajax";

const BASE_URL = '/api';

// 返回菜单列表
Mock.mock(BASE_URL + '/menu', {code: 0, data: data.menuList})

// 返回学生频道列表
Mock.mock(BASE_URL + '/channel', {code: 0, data: data.channelList})

// 获取特别链接列表
Mock.mock(BASE_URL + '/links', {code: 0, data: data.linksList})

// 获取学校列表
Mock.mock(BASE_URL + '/schools', {code: 0, data: data.schoolList})

// 获取学校详情信息
Mock.mock(BASE_URL + '/schoolsInfo', function (options) {
  let {id} = JSON.parse(options.body);
  if (data.schoolInfo[id]) {
    return {code: 0, data: data.schoolInfo[id]};
  }
  return {code: -1, data: null};
})

// 获取校园文化列表
Mock.mock(BASE_URL + '/culture', {code: 0, data: data.CultureList})

// 获取信息公开列表
Mock.mock(BASE_URL + '/infoOpen', {code: 0, data: data.InfoOpenList})

// 获取科研通知列表
Mock.mock(BASE_URL + '/science', {code: 0, data: data.ScienceList})

// 获取招生计划列表
Mock.mock(BASE_URL + '/recruit', {code: 0, data: data.RecruitList})

// 获取预决算信息列表
Mock.mock(BASE_URL + '/budget', function (options) {
  let {pageNum, pageSize} = JSON.parse(options.body);
  return commonJs.getPageData(pageNum, pageSize, data.BudgetList);

})

// 获取通知公告信息列表
Mock.mock(BASE_URL + '/notice', function (options) {
  let {pageNum, pageSize} = JSON.parse(options.body);
  return commonJs.getPageData(pageNum, pageSize, data.NoticeList);
})

// 获取首页详情列表
Mock.mock(BASE_URL + '/msite', {code: 0, data: data.MsiteList})
